//
//  MASExampleButtonAutoSizeView.m
//  MasonryExample
//
//  Created by 山刘 on 2020/6/10.
//  Copyright © 2020 山刘. All rights reserved.
//

#import "MASExampleButtonAutoSizeView.h"

@implementation MASExampleButtonAutoSizeView

- (id)init {
    self = [super init];
    if (!self) return nil;
    
    UIButton *button = [LayoutUtils createButtonWithTitle:@"UIButton宽度" target:self selector:@selector(clickButton:)];
    [self addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(self);
        //make.height.mas_equalTo(@[button.titleLabel.mas_height,button.imageView.mas_height]);
        make.height.mas_equalTo(@[button.titleLabel.mas_height]);
        make.width.mas_lessThanOrEqualTo(300);
    }];
    
    return self;
}

-(void)clickButton:(UIButton*)sender{
    [sender setTitle:[sender.currentTitle stringByAppendingString:@"自适应"] forState:UIControlStateNormal];
}

@end
